<template>
  <page-header-wrapper>
    <a-card>
      <div class="table-page-search-wrapper">
        <a-form layout="inline" class="table-head-ground">
          <div class="table-layer">
            <a-form-item label="" class="table-head-layout" style="max-width:350px;min-width:300px">
              <a-range-picker
                @change="onChange"
                format="YYYY-MM-DD"
                :value="dateArr"
              >
                <a-icon slot="suffixIcon" type="sync" />
              </a-range-picker>
            </a-form-item>
            <span class="table-page-search-submitButtons">
              <a-button type="primary" icon="search" @click="queryFunc" :loading="btnLoading">搜索</a-button>
              <a-button style="margin-left: 8px" icon="reload" @click="() => {this.searchData = {};dateArr=null;}">重置</a-button>
            </span>
          </div>
        </a-form>
      </div>

      <!-- 列表渲染 -->
      <JeepayTable
        @btnLoadClose="btnLoading=false"
        ref="infoTable"
        :initData="true"
        :reqTableDataFunc="reqTableDataFunc"
        :tableColumns="tableColumns"
        :searchData="searchData"
        rowKey="id"
        :scrollX="1000"
      >
        <template slot="status" slot-scope="{record}">
          <p v-if="record.status==0">已取消</p>
          <p v-else-if="record.status==1">待确认</p>
          <p v-else-if="record.status==2">已确认</p>
          <p v-else>--</p>
        </template>
      </JeepayTable>
    </a-card>
  </page-header-wrapper>
</template>
<script>
import JeepayTextUp from '@/components/JeepayTextUp/JeepayTextUp' // 文字上移组件
import JeepayTable from '@/components/JeepayTable/JeepayTable'
import JeepayTableColumns from '@/components/JeepayTable/JeepayTableColumns'
import { API_RECHARGE_LIST, req } from '@/api/manage'
const tableColumns = [
//   { key: 'belongInfoId', title: '订单编号', dataIndex: 'belongInfoId' },
  { key: 'money', dataIndex: 'money', title: '充值金额', customRender: (text) => '￥' + (text / 100).toFixed(2) },
  { key: 'alipayOrderNo', title: '支付宝订单编号', dataIndex: 'alipayOrderNo' },
  { key: 'status', title: '订单状态', scopedSlots: { customRender: 'status' } },
  { key: 'createdAt', title: '创建时间', dataIndex: 'createdAt' },
]

export default {
  name: 'IsvListPage',
  components: { JeepayTable, JeepayTableColumns, JeepayTextUp },
  data () {
    return {
      btnLoading: false,
      tableColumns: tableColumns,
      searchData: {},
      createdStart: '', // 选择开始时间
      createdEnd: '', // 选择结束时间
      visible: false,
      detailData: {},
      payWayList: [],
      searchData: {},
      dateArr:null
    }
  },
  computed: {
  },
  mounted () {
  },
  methods: {
    // 请求table接口数据
    reqTableDataFunc: (params) => {
      return req.list(API_RECHARGE_LIST, params)
    },
    searchFunc: function () { // 点击【查询】按钮点击事件
      this.$refs.infoTable.refTable(true)
    },
    onClose () {
      this.visible = false
    },
    onChange (date, dateString) {
      this.dateArr = dateString
      this.searchData.createdStart = dateString[0] // 开始时间
      this.searchData.createdEnd = dateString[1] // 结束时间
    },
    queryFunc () {
      this.btnLoading = true
      this.$refs.infoTable.refTable(true)
    },
  }
}
</script>
